<form action="index.php" method="post" id="createnew">
  <div id="divcreate" align="center">
  Create a new Jgirl
  <table width="339" id="createj" cellpadding="4" cellspacing="0">
    {foreach item=inputfield from=$inputfields|@sortby:position}
      {if $inputfield.flag=1}
        <tr>
          <td width="165">{$inputfield.title}: </td>
          <td width="158">
            <select id="{$inputfield.nick}">
              <option value="">Select</option>
              {foreach from=$inputfield.ref item=subject}
                <option value="{$subject.lookupkey}">{$subject.shortname}</option>
              {/foreach}
            </select>
          </td>
        </tr>
      {elseif  $inputfield.flag=2}
        <tr>
          <td width="165">{$inputfield.title}: </td>
          <td width="158">
            <input type="text" name="{$inputfield.nick}"></ br>
          </td>
        </tr>
      {/if}
    {/foreach}
  </table>
  </div>
</form>
<input type="button" id="createnew" onclick="xajax_addJgirl(xajax.getFormValues('createjgirl'))">
